Conversation
Customizable data and response to be saved into token cache
| "You can enable broker by following these instructions. " | ||
| "https://msal-python.readthedocs.io/en/latest/#publicclientapplication") | ||
|
|
||
| _TOKEN_CACHE_DATA: dict[str, str] = { # field_in_data: field_in_cache |
There was a problem hiding this comment.
The type annotation dict[str, str] for _TOKEN_CACHE_DATA uses Python 3.9+ syntax. If you intend to support Python 3.7 or 3.8 (as implied by the import on line 9), consider using Dict[str, str] from typing for compatibility.
There was a problem hiding this comment.
Consider adding a comment
# Maps field names from input data to their corresponding field names in the token cache.
# This is used to ensure that certain token types (e.g., SSH certificates, POP tokens)
# are correctly associated with their identifying keys in the cache.
There was a problem hiding this comment.
Hi @maliksahil , it has been a while, how is it going? :-)
Thanks for catching that type annotation issue. I'll take a look at why that typo was not caught by our test automation, when we revive this PR.
Why did you notice this PR in the first place? Are you working on some cutting-edge scenario that needs the behavior of this PR?
There was a problem hiding this comment.
Haha going well my friend. We are always looking at cutting edge stuff. Hope you and everyone else are well.
Inspired by its cousin in MSAL .Net, this PR refactors MSAL Python's token cache to provide an INTERNAL helper which can store additional values from token request or response.
Implementation details (which are not exactly the same as MSAL .Net, but the overall purpose is the same):
key_idwas also refactored this time to utilize the new generic declaration, and the existing test case was updated to reflect that.